<script>
export default {
  name: "FyDialog",
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    title: {
      type: String,
      default: ""
    }
  },
  data() {
    return {
      dialogVisible: false
    }
  },
  watch: {
    visible(val) {
      this.dialogVisible = val
    }
  }
}
</script>

<template>
  <el-dialog :align-center="true" center @close="this.$emit('close')" style="padding:0!important;" v-model="dialogVisible" :title="title">
    <div class="formBox">
      <slot name="form"></slot>
    </div>
    <div slot="footer" class="dialog-footer">
      <slot name="footer-btn"></slot>
    </div>
  </el-dialog>
</template>

<style lang="scss">

.dialog-footer {
  background-color: rgb(240, 242, 244);
  width: 100% !important;
  height: 50px;
  position: relative;
  border-top: 1px solid #ccc;

  > div {
    position: absolute;
    top: 0;
    right: 20px;
    bottom: 0;
    margin: auto;
    height: fit-content;
  }
}

.el-dialog__header {
  padding: 15px;
}

.formBox{
  padding: 15px;
}
</style>
